package service;

import dao.RedWineDao;
import factory.DaoFactory;
import model.RedWine;
import java.util.List;

public class RedWineServiceImpl implements RedWineService { // 红酒业务逻辑实现 完成人：姜凯严 7/3
    private RedWineDao redWineDao = DaoFactory.getRedWineDao();

    @Override
    public boolean addRedWine(RedWine redWine) { // 添加红酒
        return redWineDao.addRedWine(redWine);
    }

    @Override
    public boolean addRedWine(String name) { // 添加红酒（仅酒名）
        return redWineDao.addRedWine(name);
    }

    @Override
    public boolean addRedWine(String name, int stock, double price) { // 添加红酒（酒名、库存、单价）
        return redWineDao.addRedWine(name, stock, price);
    }

    @Override
    public boolean updateRedWine(RedWine redWine) { // 修改红酒
        return redWineDao.updateRedWine(redWine);
    }

    @Override
    public boolean updateRedWine(int redWineId, int newStock) { // 修改红酒库存
        return redWineDao.updateRedWine(redWineId, newStock);
    }

    @Override
    public boolean deleteRedWine(int redWineId) { // 删除红酒
        return redWineDao.deleteRedWine(redWineId);
    }

    @Override
    public RedWine findById(int redWineId) { // 根据ID查找红酒
        return redWineDao.findById(redWineId);
    }

    @Override
    public List<RedWine> findAll() { // 查询所有红酒
        return redWineDao.findAll();
    }

    @Override
    public List<RedWine> findByNameLike(String namePart) {
        return redWineDao.findByNameLike(namePart);
    }

    @Override
    public List<RedWine> findByOrigin(String origin) {
        return redWineDao.findByOrigin(origin);
    }

    @Override
    public List<RedWine> findByPriceRange(Double minPrice, Double maxPrice) {
        return redWineDao.findByPriceRange(minPrice, maxPrice);
    }
}
